/*-----------------------------------------------------------------------------
 * file:  if_tt.h
 * date:  Sat Mar 03 07:56:44 PDT 2011
 * Author: day2@sfu.ca
 *
 * Description:
 *
 * Methods and datastructures for handeling the ARP translation table
 *
 *---------------------------------------------------------------------------*/

#ifndef IF_TT_H
#define	IF_TT_H

#ifdef	__cplusplus
extern "C" {
#endif
#define TRANS_LIFE  15 /*timout time of 15 seconds*/

#include <netinet/in.h>
#include <stdint.h>
#include "sr_if.h"
    
#ifdef	__cplusplus
}
#endif

struct if_tt
{
    unsigned char       hrd_addr[6];
    uint32_t 		ip;
    time_t 		ttl;
    struct if_tt* 	prev;
    struct if_tt* 	next;
};

void if_kill_trans(struct sr_if*,struct if_tt*);
void if_add_trans(struct sr_if*, unsigned char*, uint32_t*);
struct if_tt* if_find_trans(struct sr_if*, uint32_t*);
unsigned char* if_get_hrd_from_ip(struct sr_if*, uint32_t*);
void if_update_trans(struct if_tt*, unsigned char*);
void if_check_time(struct sr_if*);
void if_print_table(struct sr_if*);
void if_print_table_entry(struct if_tt*);

#endif	/* IF_TT_H */

